<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/common/taglibs.jsp"%>
<link rel="stylesheet" type="text/css" href="${ctx}/styles/pop.css" media="screen"/>
<script type="text/javascript" src="${ctx}/scripts/jquery/jquery.form.js"></script>
<div class="pop_roster_request">
	<form id="f_wish_make" action="<c:url value='/wish/make.do'/>" method="post">
		<c:if test="${not empty wishType}">
			<input type="hidden" name="wtid" value="${wishType.typeid}">
			类型：<c:out value="${wishType.name}"></c:out>
		</c:if>
		<c:if test="${empty wishType}">
			类型：<select name="wtid">
			<c:forEach var="wtype" items="${types}">
				<option value="${wtype.typeid}"><c:out value="${wtype.name}"/></option>
			</c:forEach>
			</select>
		</c:if>
		<br/>
		愿望：<textarea name="content" cols="50" rows="10"></textarea>
		<br/>
		允许祝福：<input type="checkbox" name="replyable" value="1" checked="checked">
		<br/>
		<button type="submit" class="btn3" >许愿</button>
	</form>
</div>
<script>
$("#f_wish_make").ajaxForm({
	dataType:'xml', 
	type:'post',
	success: processMakeWishResult
});
function processMakeWishResult(result){
	if($(result).find('result').text().toUpperCase().indexOf("TRUE") >= 0){
		var wid = $(result).find('content').text();
		$.fn.colorbox.close();
		window.location.href=ctx + "/wish/index.do?wid="+wid;
	}else{
		alert("愿望女神正在休息，请稍等在许愿！");
	}
}
</script>